<?php

// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\admin\controller;

use app\admin\service\NodeService;
use library\Controller;
use library\tools\Data;
use think\Console;
use think\Db;
use think\exception\HttpResponseException;

/**
 * 学校管理
 * Class Index
 * @package app\admin\controller
 */
class School extends Controller
{
    /**
     * 绑定数据表
     * @var string
     */
    protected $table = 'School';

    /**
     * 学校列表
     * @auth true
     * @menu true
     */
    public function index()
    {
        $this->title = '学校列表';
        $query = $this->_query($this->table)->like('name')->equal('status');
        $query->order('id desc')->page();
    }

    /**
     * 添加学校
     */
    public function schoolAdd()
    {   

        $this->title = '添加学校';
        $this->_form($this->table, 'school_add');
       
    }

    /**
     * 
     * 修改学校
     */
    public function edit(){

        $this->title="修改学校";
        $this->_form($this->table, 'school_add');
    }



    /**
    * 专业列表
     * @auth true
     * @menu true
     
     */
    public function schoolMajor(){

       
        $this->title="专业列表";
      
        $query = $this->_query("schoolMajor")
                ->like('name')
                ->equal('name');
        $query->order('id desc')->page();
        $this->fetch();
        
    }
    
    /**
     * 
     * 添加专业
     */
    public function schoolMajorAdd(){
        $school_id = $this->request->param('school_id', 0);
        $college_id = $this->request->param('college_id', 0);
        $this->assign('school_id',$school_id);
        $this->assign('college_id',$college_id);
        $this->title = '添加专业';
        $this->_form("SchoolMajor", 'school_major_add');
    }

    /**
     * 
     * 编辑专业
     */
    public function editMajor(){
        $this->title="编辑学院";
        $this->_form("SchoolMajor", 'school_major_add');
    }


}
